package com.wisdom.benefit.jufa.utils;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.wisdom.benefit.jufa.base.BaseApplication;
import com.wisdom.benefit.jufa.main.LoginActivity;

/**
 * Created by zhoudawei on 2017/2/10.
 */

public final class RedirectUtil {

    public static void checkLoginBeforeStartActivity(Context context, Class<?> clazz, Bundle bundle) {
        if (!BaseApplication.getContext().isLogin()) {
            Intent intent = new Intent(context, LoginActivity.class);
            intent.putExtra(KeyUtil.KEY_LOGIN_TARGET_CLASS, clazz);
            intent.putExtras(bundle);
            context.startActivity(intent);
            return;
        }
        Intent intent = new Intent(context, clazz);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    public static void checkLoginBeforeStartActivity(Context context, Class<?> clazz) {
        checkLoginBeforeStartActivity(context, clazz, new Bundle());
    }
}
